//****************************************************************
//Autor:   Yimy Juarez 
//       Gustavo Castro
//       Ulil Cojti
//       Josue Barrientos
//    
//Seccion: 10
//Nombre del Archivo: forms.java
//Fecha de Modificacion: 30/09/2012
//***************************************************************
package demo;

import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;
import javax.microedition.lcdui.game.*;
import java.io.IOException;
import java.util.Vector;

/**
 * @author miriam
 */
public class mapa {
    
//<editor-fold defaultstate="collapsed" desc=" Generated Fields ">//GEN-BEGIN:|fields|0|
    private Image grama;
    private Image topview_tiles;
    private Image ground2;
    private Image ground;
    private Sprite boy1;
    public int boy1seq001Delay = 200;
    public int[] boy1seq001 = {88, 89, 90, 91, 92};
    private TiledLayer fondo;
    private TiledLayer sp2;
    private Image ground3;
    private TiledLayer sp1;
    private Sprite x;
    public int xseq001Delay = 200;
    public int[] xseq001 = {9, 9, 9, 9, 9};
    private Sprite marcador;
    public int marcadorseq002Delay = 200;
    public int[] marcadorseq002 = {158, 158, 158, 158, 158};
    private Image ground4;
    private TiledLayer sp4;
    private TiledLayer sp3;
//</editor-fold>//GEN-END:|fields|0|
    
//<editor-fold defaultstate="collapsed" desc=" Generated Methods ">//GEN-BEGIN:|methods|0|
//</editor-fold>//GEN-END:|methods|0|



    public Image getGrama() throws java.io.IOException {//GEN-BEGIN:|2-getter|0|2-preInit
        if (grama == null) {//GEN-END:|2-getter|0|2-preInit
            // write pre-init user code here
            
            grama = Image.createImage("/ground2.png");//GEN-BEGIN:|2-getter|1|2-postInit
        }//GEN-END:|2-getter|1|2-postInit
        // write post-init user code here
        return this.grama;//GEN-BEGIN:|2-getter|2|
    }//GEN-END:|2-getter|2|

    public Image getGround() throws java.io.IOException {//GEN-BEGIN:|10-getter|0|10-preInit
        if (ground == null) {//GEN-END:|10-getter|0|10-preInit
            // write pre-init user code here
            ground = Image.createImage("/ground.png");//GEN-BEGIN:|10-getter|1|10-postInit
        }//GEN-END:|10-getter|1|10-postInit
        // write post-init user code here
        return this.ground;//GEN-BEGIN:|10-getter|2|
    }//GEN-END:|10-getter|2|

    public TiledLayer getFondo() throws java.io.IOException {//GEN-BEGIN:|11-getter|0|11-preInit
        if (fondo == null) {//GEN-END:|11-getter|0|11-preInit
            // write pre-init user code here
            fondo = new TiledLayer(33, 25, getGround(), 19, 19);//GEN-BEGIN:|11-getter|1|11-midInit
            int[][] tiles = {
                {134, 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126},
                {134, 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126},
                {134, 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126},
                {135, 135, 135, 135, 135, 135, 134, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126},
                {135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126},
                {135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126},
                {135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126},
                {135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126},
                {135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126},
                {135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126},
                {135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126},
                {135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126},
                {135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126},
                {135, 135, 135, 126, 135, 135, 135, 126, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126},
                {135, 135, 126, 126, 135, 135, 135, 126, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126},
                {135, 126, 126, 126, 135, 135, 126, 126, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126},
                {126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126},
                {126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126},
                {126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126},
                {126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126},
                {126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126},
                {135, 126, 126, 126, 135, 135, 135, 135, 126, 126, 126, 135, 135, 135, 135, 135, 135, 135, 135, 135, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126},
                {135, 126, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126},
                {135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126},
                {135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126}
            };//GEN-END:|11-getter|1|11-midInit
            // write mid-init user code here
            for (int row = 0; row < 25; row++) {//GEN-BEGIN:|11-getter|2|11-postInit
                for (int col = 0; col < 33; col++) {
                    fondo.setCell(col, row, tiles[row][col]);
                }
            }
        }//GEN-END:|11-getter|2|11-postInit
        // write post-init user code here
        return fondo;//GEN-BEGIN:|11-getter|3|
    }//GEN-END:|11-getter|3|



    public TiledLayer getSp1() throws java.io.IOException {//GEN-BEGIN:|19-getter|0|19-preInit
        if (sp1 == null) {//GEN-END:|19-getter|0|19-preInit
            // write pre-init user code here
            
            sp1 = new TiledLayer(2, 1, getGround(), 19, 19);//GEN-BEGIN:|19-getter|1|19-midInit
            int[][] tiles = {
                {22, 23}
            };//GEN-END:|19-getter|1|19-midInit
            // write mid-init user code here
            
            for (int row = 0; row < 1; row++) {//GEN-BEGIN:|19-getter|2|19-postInit
                for (int col = 0; col < 2; col++) {
                    sp1.setCell(col, row, tiles[row][col]);
                }
            }
        }//GEN-END:|19-getter|2|19-postInit
        else{
            sp1 = new TiledLayer(2, 1, getGround(), 19, 19);
            int[][] tiles = {
                {22, 23}
            };
            // write mid-init user code here
            
            for (int row = 0; row < 1; row++) {
                for (int col = 0; col < 2; col++) {
                    sp1.setCell(col, row, tiles[row][col]);
                }
            }
        }
       
        // write post-init user code here
        return sp1;//GEN-BEGIN:|19-getter|3|
    }//GEN-END:|19-getter|3|

    public void updateLayerManagerForEscena(LayerManager lm) throws java.io.IOException {//GEN-LINE:|26-updateLayerManager|0|26-preUpdate
        // write pre-update user code here
        getFondo().setPosition(-7, 0);//GEN-BEGIN:|26-updateLayerManager|1|26-postUpdate
        getFondo().setVisible(true);
        lm.append(getFondo());//GEN-END:|26-updateLayerManager|1|26-postUpdate
        // write post-update user code here
    }//GEN-LINE:|26-updateLayerManager|2|

    public Image getGround2() throws java.io.IOException {//GEN-BEGIN:|78-getter|0|78-preInit
        if (ground2 == null) {//GEN-END:|78-getter|0|78-preInit
            // write pre-init user code here
            ground2 = Image.createImage("/ground2.png");//GEN-BEGIN:|78-getter|1|78-postInit
        }//GEN-END:|78-getter|1|78-postInit
        // write post-init user code here
        return this.ground2;//GEN-BEGIN:|78-getter|2|
    }//GEN-END:|78-getter|2|

    public Sprite getX() throws java.io.IOException {//GEN-BEGIN:|115-getter|0|115-preInit
        if (x == null) {//GEN-END:|115-getter|0|115-preInit
            // write pre-init user code here
            x = new Sprite(getGround2(), 19, 19);//GEN-BEGIN:|115-getter|1|115-postInit
            x.setFrameSequence(xseq001);//GEN-END:|115-getter|1|115-postInit
            // write post-init user code here
        }//GEN-BEGIN:|115-getter|2|
        return x;
    }//GEN-END:|115-getter|2|

    public Image getGround3() throws java.io.IOException {//GEN-BEGIN:|118-getter|0|118-preInit
        if (ground3 == null) {//GEN-END:|118-getter|0|118-preInit
            // write pre-init user code here
            ground3 = Image.createImage("/ground3.png");//GEN-BEGIN:|118-getter|1|118-postInit
        }//GEN-END:|118-getter|1|118-postInit
        // write post-init user code here
        return this.ground3;//GEN-BEGIN:|118-getter|2|
    }//GEN-END:|118-getter|2|

    public TiledLayer getSp2() throws java.io.IOException {//GEN-BEGIN:|119-getter|0|119-preInit
        if (sp2 == null) {//GEN-END:|119-getter|0|119-preInit
            // write pre-init user code here
            sp2 = new TiledLayer(2, 2, getGround3(), 19, 19);//GEN-BEGIN:|119-getter|1|119-midInit
            int[][] tiles = {
                {146, 147},
                {162, 163}
            };//GEN-END:|119-getter|1|119-midInit
            // write mid-init user code here
            for (int row = 0; row < 2; row++) {//GEN-BEGIN:|119-getter|2|119-postInit
                for (int col = 0; col < 2; col++) {
                    sp2.setCell(col, row, tiles[row][col]);
                }
            }
        }//GEN-END:|119-getter|2|119-postInit
        else{
                        sp2 = new TiledLayer(2, 2, getGround3(), 19, 19);
            int[][] tiles = {
                {146, 147},
                {162, 163}
            };
            // write mid-init user code here
            for (int row = 0; row < 2; row++) {
                for (int col = 0; col < 2; col++) {
                    sp2.setCell(col, row, tiles[row][col]);
                }
            }

        }
        // write post-init user code here
        return sp2;//GEN-BEGIN:|119-getter|3|
    }//GEN-END:|119-getter|3|

    public TiledLayer getSp3() throws java.io.IOException {//GEN-BEGIN:|120-getter|0|120-preInit
        if (sp3 == null) {//GEN-END:|120-getter|0|120-preInit
            // write pre-init user code here
            sp3 = new TiledLayer(2, 2, getGround3(), 19, 19);//GEN-BEGIN:|120-getter|1|120-midInit
            int[][] tiles = {
                {14, 15},
                {30, 31}
            };//GEN-END:|120-getter|1|120-midInit
            // write mid-init user code here
            for (int row = 0; row < 2; row++) {//GEN-BEGIN:|120-getter|2|120-postInit
                for (int col = 0; col < 2; col++) {
                    sp3.setCell(col, row, tiles[row][col]);
                }
            }
        }//GEN-END:|120-getter|2|120-postInit
        // write post-init user code here
        else{
                        sp3 = new TiledLayer(2, 2, getGround3(), 19, 19);
            int[][] tiles = {
                {14, 15},
                {30, 31}
            };
            // write mid-init user code here
            for (int row = 0; row < 2; row++) {
                for (int col = 0; col < 2; col++) {
                    sp3.setCell(col, row, tiles[row][col]);
                }
            }

        }
        return sp3;//GEN-BEGIN:|120-getter|3|
    }//GEN-END:|120-getter|3|

    public TiledLayer getSp4() throws java.io.IOException {//GEN-BEGIN:|121-getter|0|121-preInit
        if (sp4 == null) {//GEN-END:|121-getter|0|121-preInit
            // write pre-init user code here
            sp4 = new TiledLayer(1, 1, getGround3(), 19, 19);//GEN-BEGIN:|121-getter|1|121-midInit
            int[][] tiles = {
                {152}
            };//GEN-END:|121-getter|1|121-midInit
            // write mid-init user code here
            for (int row = 0; row < 1; row++) {//GEN-BEGIN:|121-getter|2|121-postInit
                for (int col = 0; col < 1; col++) {
                    sp4.setCell(col, row, tiles[row][col]);
                }
            }
        }//GEN-END:|121-getter|2|121-postInit
        // write post-init user code here
        else{
             sp4 = new TiledLayer(1, 1, getGround3(), 19, 19);
            int[][] tiles = {
                {152}
            };
            // write mid-init user code here
            for (int row = 0; row < 1; row++) {
                for (int col = 0; col < 1; col++) {
                    sp4.setCell(col, row, tiles[row][col]);
                }
            }
           
        }
        return sp4;//GEN-BEGIN:|121-getter|3|
    }//GEN-END:|121-getter|3|

    public Image getGround4() throws java.io.IOException {//GEN-BEGIN:|126-getter|0|126-preInit
        if (ground4 == null) {//GEN-END:|126-getter|0|126-preInit
            // write pre-init user code here
            ground4 = Image.createImage("/ground4.png");//GEN-BEGIN:|126-getter|1|126-postInit
        }//GEN-END:|126-getter|1|126-postInit
        // write post-init user code here
        return this.ground4;//GEN-BEGIN:|126-getter|2|
    }//GEN-END:|126-getter|2|

    public Sprite getMarcador() throws java.io.IOException {//GEN-BEGIN:|127-getter|0|127-preInit
        if (marcador == null) {//GEN-END:|127-getter|0|127-preInit
            // write pre-init user code here
            marcador = new Sprite(getGround4(), 19, 19);//GEN-BEGIN:|127-getter|1|127-postInit
            marcador.setFrameSequence(marcadorseq002);//GEN-END:|127-getter|1|127-postInit
            // write post-init user code here
        }//GEN-BEGIN:|127-getter|2|
        return marcador;
    }//GEN-END:|127-getter|2|

    public Image getTopview_tiles() throws java.io.IOException {//GEN-BEGIN:|129-getter|0|129-preInit
        if (topview_tiles == null) {//GEN-END:|129-getter|0|129-preInit
            // write pre-init user code here
            topview_tiles = Image.createImage("/topview_tiles.png");//GEN-BEGIN:|129-getter|1|129-postInit
        }//GEN-END:|129-getter|1|129-postInit
        // write post-init user code here
        return this.topview_tiles;//GEN-BEGIN:|129-getter|2|
    }//GEN-END:|129-getter|2|

    public Sprite getBoy1() throws java.io.IOException {//GEN-BEGIN:|130-getter|0|130-preInit
        if (boy1 == null) {//GEN-END:|130-getter|0|130-preInit
            // write pre-init user code here
            boy1 = new Sprite(getTopview_tiles(), 16, 16);//GEN-BEGIN:|130-getter|1|130-postInit
            boy1.setFrameSequence(boy1seq001);//GEN-END:|130-getter|1|130-postInit
            // write post-init user code here
        }//GEN-BEGIN:|130-getter|2|
        return boy1;
    }//GEN-END:|130-getter|2|
    
}
